package edu.online.dal;

import edu.online.entity.LessonScheduleEntity;
import org.apache.ibatis.jdbc.SQL;

public class LessonScheduleEntitySqlProvider {

    public String insertSelective(LessonScheduleEntity record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("lessonschedule");
        
        if (record.getLessonscheduleid() != null) {
            sql.VALUES("LessonScheduleID", "#{lessonscheduleid,jdbcType=CHAR}");
        }
        
        if (record.getLessonid() != null) {
            sql.VALUES("LessonID", "#{lessonid,jdbcType=CHAR}");
        }
        
        if (record.getUserid() != null) {
            sql.VALUES("UserId", "#{userid,jdbcType=CHAR}");
        }
        
        if (record.getSeqno() != null) {
            sql.VALUES("SeqNo", "#{seqno,jdbcType=SMALLINT}");
        }
        
        if (record.getLessontime() != null) {
            sql.VALUES("LessonTime", "#{lessontime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getStatus() != null) {
            sql.VALUES("Status", "#{status,jdbcType=VARCHAR}");
        }
        
        if (record.getLeaveid() != null) {
            sql.VALUES("LeaveID", "#{leaveid,jdbcType=CHAR}");
        }
        
        if (record.getSwitchid() != null) {
            sql.VALUES("SwitchID", "#{switchid,jdbcType=CHAR}");
        }
        
        if (record.getNewlessontime() != null) {
            sql.VALUES("NewLessonTime", "#{newlessontime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getComment() != null) {
            sql.VALUES("Comment", "#{comment,jdbcType=VARCHAR}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(LessonScheduleEntity record) {
        SQL sql = new SQL();
        sql.UPDATE("lessonschedule");
        
        if (record.getLessonid() != null) {
            sql.SET("LessonID = #{lessonid,jdbcType=CHAR}");
        }
        
        if (record.getUserid() != null) {
            sql.SET("UserId = #{userid,jdbcType=CHAR}");
        }
        
        if (record.getSeqno() != null) {
            sql.SET("SeqNo = #{seqno,jdbcType=SMALLINT}");
        }
        
        if (record.getLessontime() != null) {
            sql.SET("LessonTime = #{lessontime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getStatus() != null) {
            sql.SET("Status = #{status,jdbcType=VARCHAR}");
        }
        
        if (record.getLeaveid() != null) {
            sql.SET("LeaveID = #{leaveid,jdbcType=CHAR}");
        }
        
        if (record.getSwitchid() != null) {
            sql.SET("SwitchID = #{switchid,jdbcType=CHAR}");
        }
        
        if (record.getNewlessontime() != null) {
            sql.SET("NewLessonTime = #{newlessontime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getComment() != null) {
            sql.SET("Comment = #{comment,jdbcType=VARCHAR}");
        }
        
        sql.WHERE("LessonScheduleID = #{lessonscheduleid,jdbcType=CHAR}");
        
        return sql.toString();
    }
}